package com.zr.daoimpl;

import java.util.List;

import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.transform.Transformers;
import org.springframework.stereotype.Repository;

import com.zr.dao.CargostatusdaoCH;
import com.zr.model.Cargostatus;
import com.zr.vo.Cargostusch;

import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
@Repository("CargostatusdaoCH")
public class CargostatusdaoimplCH extends BaseDaOImpl implements CargostatusdaoCH{
	  
	@Override
	public JSONArray getAllCargostatus() {
		// TODO Auto-generated method stub
		JSONArray js=new JSONArray();
		String hq1 = "from Cargostatus";
		Query query = this.getCurrentSession().createQuery(hq1);
		List<Cargostatus> ss  =query.list();
		for (Cargostatus cargostatus : ss) {
			JSONObject jj=new JSONObject();
			jj.put("csId", cargostatus.getCsId());
			jj.put("package", cargostatus.getPackagebag().getPackageId());
		//	jj.put("orId", cargostatus.getOrder().getOrId());
			jj.put("csCurrentLocation", cargostatus.getCsCurrentLocation());
			jj.put("csNextLocation", cargostatus.getCsNextLocation());
			jj.put("csCurrentDate", cargostatus.getCsCurrentDate());
		//	jj.put("driverId", cargostatus.getDriver().getDriverId());				
			js.add(jj);	
		}    	 		    	
		return js;
		
	}
	
}
